package cn.sccl.dirms.topo.discovery.util;

import java.util.List;

/**
 * Created by julei on 2017/9/29.
 */
public class IfLine {
    public IfLine(List<IfPoint> points) {
        double max = 0;
        double min = 999999999;
        for (int i = 0; i < points.size(); i++) {
            IfPoint p = points.get(i);
            if (i == 0) {
                start = p;
                startValue = p.y;
            }
            if (i == points.size() - 1) {
                end = p;
                endValue = p.y;
            }
            if (p.y > max) {
                max = p.y;
                maxPoint = p;
            }
            if (p.y < min) {
                min = p.y;
                minPoint = p;
            }
        }
        if (max > 0) {
            maxValue = max;
        }
        if (min < 999999999) {
            minValue = min;
        }
    }

    public IfPoint start;
    public IfPoint end;
    public double startValue;
    public double endValue;
    public IfPoint maxPoint;
    public IfPoint minPoint;
    public double maxValue;
    public double minValue;

    public double getDistance(){
        return (endValue-startValue);
    }

}
